package com.bwie.kanjia.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bwie.kanjia.entity.ActEntity;
import com.bwie.kanjia.service.ActService;
import com.bwie.common.utils.PageUtils;
import com.bwie.common.utils.R;



/**
 * 
 *
 * @author ÕÔË«Ò¶
 * @email 1535715783@qq.com
 * @date 2022-03-07 20:38:40
 */
@RestController
@RequestMapping("kanjia/act")
public class ActController {
    @Autowired
    private ActService actService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = actService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{actId}")
    public R info(@PathVariable("actId") Integer actId){
		ActEntity act = actService.getById(actId);

        return R.ok().put("act", act);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ActEntity act){
		actService.save(act);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ActEntity act){
		actService.updateById(act);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] actIds){
		actService.removeByIds(Arrays.asList(actIds));

        return R.ok();
    }

}
